function language_form_dialog(url) {
    
   var tips = $( ".validateTips" );

   $( "#language_form" ).dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        buttons: {
            "Inserisci": function() {
                var bValid = true;
                $( '#language_name' ).removeClass( "ui-state-error" );

                bValid = bValid && checkLength( $( "#language_name" ), "Nome", 3, 255 );
                if ( bValid ) {
                    /* inserisce tramite AJAX le informazioni su una nuova 
                     * organizzazione ==== TODO: gestire errori
                     */
                    $.ajax({
                        url: url,
                        type: 'POST',                 
                        async: false,
                        data: {name: $( '#language_name' ).val()},
                        success: function(new_language_id) {
                            language_name = $( '#language_name' ).val();
                            // append del nuovo elemento alla select
                            $( '#LanguageExperienceLanguageId' )
                                    .append(
                                        $('<option></option>')
                                            .attr('value', new_language_id)
                                            .text(language_name)
                                    );
                        }
                    });   
                    $( this ).dialog( "close" );

               }
            },
            "Annulla": function() {
                    $( this ).dialog( "close" );
            }
        },
        close: function() {
                $( '#language_name' ).val( "" ).removeClass( "ui-state-error" );
        }
    });
    
}


